//
//  SettingsViewController.m
//  Bluetooth Chat App
//
//  Created by iD Student on 7/18/13.
//  Copyright (c) 2013 ZTBWorks. All rights reserved.
//

#import "SettingsViewController.h"

@interface SettingsViewController ()

@end

@implementation SettingsViewController


- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    CGFloat size = 25;
    newArray = [[NSArray alloc]initWithObjects:
                [UIFont fontWithName:@"digitalanarchy-Regular" size:(size - [@"10" floatValue])],
                         [UIFont fontWithName:@"Dimitri" size:size],
                         [UIFont fontWithName:@"Dimitri Swank" size:size],
                         [UIFont fontWithName:@"LunasolAurora-Regular" size:size],
                         [UIFont fontWithName:@"LunasolEclipse-Regular" size:size],
                         [UIFont fontWithName:@"Techno Hideo" size:size],
                         [UIFont fontWithName:@"Technoid" size:size],
                         [UIFont fontWithName:@"Tr2n" size:size],
                         [UIFont fontWithName:@"Squared Display" size:size],
                         nil];
    UIFont *font = [UIFont fontWithName:@"DIMIS" size:size];
    fontPicker.delegate = self;
    fontPicker.dataSource = self;
    NSLog(@"newArray.count: %d", newArray.count);
    _fontPreviewLabel.font = [newArray objectAtIndex:0];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidUnload {
    [self setFontPreviewLabel:nil];
    [super viewDidUnload];
}

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return newArray.count;
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    self.fontPreviewLabel.font = [newArray objectAtIndex:row];
    self.appDelegate.selectedFont = [newArray objectAtIndex:row];
    NSLog([self.appDelegate.selectedFont fontName]);
    NSLog(@"slected");
}

-(NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [[newArray objectAtIndex:row] fontName];
}

- (IBAction)goBack:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

@end
